<!-- !+tabs -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/react.js"></script>
    <script src="js/browser.min.js"></script>
    <script src="js/react-dom.js"></script>
</head>
<body>
    <div id="example"></div>

    <script type="text/babel">
        var MyComponent = React.createClass({
            myName:'张三',
            render:function(){
                return <input type='text' placeholder="请输入"/>
            }
        });

        var TestComponent = React.createClass({
            handleClick:function(){
                //希望能够获取到MyComponent组件类中定义myName
                console.log(this.refs.my.myName)
            },
            render:function(){
                return <div>
                 <MyComponent ref="my"></MyComponent>
                 <button 
                 onClick={this.handleClick}>
                 clickMe
                 </button>
                </div>
            }
        });




        ReactDOM.render(
            <TestComponent></TestComponent>,
            document.getElementById('example')
        );
    </script>
</body>
</html>